<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateArticlesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::unprepared('
            CREATE TABLE `articles` (
              `id` int(10) NOT NULL,
              `journal_id` int(10) NOT NULL,
              `issue_id` int(10) DEFAULT NULL,
              `cate_id` int(10) DEFAULT NULL,
              `page_start` int(10) DEFAULT "0",
              `page_end` int(10) NOT NULL DEFAULT"0",
              `cite_count` int(10) NOT NULL DEFAULT "0",
              `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
              `id_doi` varchar(255) COLLATE utf8_unicode_ci DEFAULT
               NULL,
              `author_list` text COLLATE utf8_unicode_ci DEFAULT NULL,
              `affiliation` text COLLATE utf8_unicode_ci,
              `corresponding_info` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
              `abstract` text COLLATE utf8_unicode_ci,
              `keywords` text COLLATE utf8_unicode_ci DEFAULT NULL,
              `fund` text COLLATE utf8_unicode_ci,
              `is_pic` tinyint(1) NOT NULL DEFAULT "0",
              `is_featured` tinyint(1) NOT NULL DEFAULT "0",
              `is_press` tinyint(1) NOT NULL DEFAULT "0",
              `accept_date` datetime DEFAULT NULL,
              `revision_date` datetime DEFAULT NULL,
              `publish_date` datetime DEFAULT NULL,
              `pdf` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
              `xml` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
              `html` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
              `imgs` text COLLATE utf8_unicode_ci,
              `zr_id` int(10) DEFAULT NULL,
              `created_at` datetime DEFAULT NULL,
              `updated_at` datetime DEFAULT NULL,
              PRIMARY KEY (`id`),
              KEY `issue_id` (`issue_id`)
            ) ENGINE=InnoDB AUTO_INCREMENT=3380 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
            ');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('articles');
    }
}
